package com.awesome.javademo.lang;

import com.awesome.common.util.log.ShowLogUtil;

import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;

/**
 * Author: zhangjingfang
 * Email:zhangjingfang@jeejio.com
 * Date: 2021/7/28 7:40 上午
 * Description:基本语法
 */
public class Language {
    public static void test(){
//        userPhone.replaceRange(3,7,"****")

        String phone = "15211112222";
        phone = phone.substring(0,3)+"****"+phone.substring(7,11);
        ShowLogUtil.info(String.format("%s，你好,我的电话号码是%s","Jane",phone));
    }

//    public void sum(){
//
//    }
//
//    public String sum(){
//        return null;
//    }

    public static void regex(){
        String ssid = "Jeejio-01271800002200000008-8585";
        String regex = "Jeejio-[0-9]*-[0-9]{4}";
        ShowLogUtil.info("ssid="+ ssid);
        ShowLogUtil.info(Pattern.matches(regex,ssid));
    }

    public static void StringAndByte(){
        String a = "1233你好";
        byte[] bytes = a.getBytes();
        for (Byte b : bytes ) {
            ShowLogUtil.info(b.toString());
        }
        String str = new String(bytes, StandardCharsets.UTF_8);
        ShowLogUtil.info(str);
    }
} 